package com.fs.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fs.entity.Attractions;
import com.fs.service.AttractionsService;
import com.fs.dao.AttractionsMapper;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

/**
 * @author hua
 * @version 1.0
 * @title AttractionsServiceImpl
 * @description 景点信息服务实现类
 * @create 2024/4/16 17:04
 */
@Service("AttractionsService")
public class AttractionsServiceImpl implements AttractionsService {
    @Resource
    private AttractionsMapper attractionsMapper;

    @Override
    public List<Attractions> select() {
        return null;
    }

    @Override
    public Attractions selectById(Serializable y) {
        return null;
    }

    @Override
    public Attractions find(Object id) {
        return null;
    }

    @Override
    public Attractions findEntity(Attractions id) {
        return null;
    }

    @Override
    public List<Attractions> selectPage(int pageNum, int pageSize) {
        return null;
    }


    @Override
    public int delete(Serializable id) {
        return 0;
    }

    @Override
    public int insert(Attractions y) {
        return 0;
    }

    @Override
    public int update(Attractions y) {
        return 0;
    }

    @Override
    public List<Attractions> getHotAttractions(){
        IPage page = new Page(1,3);
        LambdaQueryWrapper<Attractions> queryWrapper=new LambdaQueryWrapper<>();
        queryWrapper.orderByAsc(Attractions::getPageviews);
        attractionsMapper.selectPage(page,queryWrapper);
        return page.getRecords();
    }

    @Override
    public List<Attractions> getList() {
        return attractionsMapper.selectAll();
    }
}
